#!/bin/bash
# vim: set ft=sh

set -e

OUTPUT="$PWD/bosh-rc"
VERSION="$(cat version/version)"
FINAL_VERSION="$(cat final-version/version)"

mv fly-rc/fly_* concourse/src/fly_binaries/

pushd concourse/
  echo "$FINAL_VERSION" > src/version/VERSION

  # work-around Go BOSH CLI trying to rename blobs downloaded into ~/.root/tmp
  # into release dir, which is invalid cross-device link
  export HOME=$PWD

  bosh -n create-release --name concourse --version "$VERSION" --tarball "$OUTPUT/concourse-$VERSION.tgz"
popd
